def isfunction(a,d):
    A=a
    b=a
    B=b
    for i in range(3):
        a=a+d
        A=A+a
    for j in range(3):
        b=b+d
        B=B*b
    if A==26 and B==880:
        return 1
    else:
        return 0
for a in range(4):
    for d in range(4):
        if isfunction(a,d)==1:
            print(a,d)
